unit ChameleonPawn;

interface

uses Pawn, Graphics, ColorsContainer, Player;

type

 TChameleonPawn = class(TPawnWithImage)
 private
  colContainer: TColorContainer;
 public
  constructor Create(Dim: integer; Color: TColor; Value: Integer; col: TColorContainer);
  procedure OnMoved(Player: TPlayer); override;
 end;

implementation

procedure TChameleonPawn.OnMoved(Player: TPlayer);
var
 col: ColorContainer;
begin
 col := colContainer.GetRandomColor;
 Color := col.Color;
 Value := col.Value;
end;

constructor TChameleonPawn.Create(Dim: integer; Color: TColor; Value: Integer; col: TColorContainer);
begin
 inherited Create(Dim, Color, Value, 'graph\chameleon.bmp');
 colContainer := col;
end;

end.
